package cn.gov.pbc.dream.common;

import lombok.AllArgsConstructor;
import lombok.Getter;

public interface CustomerConst {


    @Getter
    @AllArgsConstructor
    public enum DebtorCertypeEnum {
        UNIFORM_CODE("B00", "统一社会信用代码"),
        ORGANIZATION_CODE("B01", "组织机构代码"),
        PERSON_ID("B02", "个人身份证");

        private String code;
        private String value;

        public static DebtorCertypeEnum codeOf(String code) {
            for (DebtorCertypeEnum debtorCertypeEnum : values()) {
                if (debtorCertypeEnum.getCode().equals(code)) {
                    return debtorCertypeEnum;
                }
            }
            return null;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum CustomerTypeEnum {
        UNIT(0, "单位客户"),
        INDIVIDUAL(1, "个体工商户"),
        SMALL_BUSINESS_OWNER(2, "小微企业主"),
        PERSON(3, "普通个人");
        private int code;
        private String value;

        public static CustomerTypeEnum codeOf(int code) {
            for (CustomerTypeEnum customerTypeEnum : values()) {
                if (customerTypeEnum.getCode() == code) {
                    return customerTypeEnum;
                }
            }
            return null;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum EcoTypeEnum {
        STATE("A01", "国有控股"),
        GROUP("A02", "集体控股"),
        PERSONAL("B01", "私人控股"),
        SPECIAl_DISTRICT("B02", "港澳台控股"),
        FOREIGN("B03", "外商控股"),
        NO_FIRM("C01", "非企业");
        private String code;
        private String value;

        public static EcoTypeEnum codeOf(String code) {
            for (EcoTypeEnum ecoTypeEnum : values()) {
                if (ecoTypeEnum.getCode().equals(code)) {
                    return ecoTypeEnum;
                }
            }
            return null;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum CustomerScale {
        LARGE("CS01", "大型"),
        MEDIUM("CS02", "中型"),
        SMALL("CS03", "小型"),
        MICRO("CS04", "微型"),
        NO_FIRM("CS05", "非企业")
        ;
        private String code;
        private String value;

        public static CustomerScale codeOf(String code){
            for(CustomerScale customerTypeEnum: values()){
                if(customerTypeEnum.getCode().equals(code)){
                    return customerTypeEnum;
                }
            }
            return null;
        }
    }
}
